﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;

namespace MyVoteMVC.Domain
{
    public class VT_Items
    {
        /// <summary>
        /// PK Guid
        /// </summary>
        public string Item_ID { get; set; }

        /// <summary>
        /// FK 选项所属问题ID
        /// </summary>
        public string Question_ID { get; set; }

        /// <summary>
        /// FK 选项所属项目ID
        /// </summary>
        public string Project_ID { get; set; }

        /// <summary>
        /// 选项自编号
        /// </summary>
        public int? Item_No { get; set; }

        /// <summary>
        /// 选项标题
        /// </summary>
        public string Item_Title { get; set; }

        /// <summary>
        /// 选项描述
        /// </summary>
        public string Item_Content { get; set; }

        /// <summary>
        /// 是否默认选中
        /// </summary>
        public int? Item_IfDefault { get; set; }

        public string Item_IfDefaultText
        {
            get
            {
                return (Item_IfDefault.Value == 1 ? "是" : "否");
            }
        }

        /// <summary>
        /// 创建人
        /// </summary>
        public string Created_By { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? Created_Date { get; set; }

        /// <summary>
        /// 创建方法
        /// </summary>
        public string Created_Action { get; set; }

        /// <summary>
        /// 更新人
        /// </summary>
        public string Last_Update_By { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? Last_Update_Date { get; set; }

        /// <summary>
        /// 更新方法
        /// </summary>
        public string Last_Update_Action { get; set; }

        /// <summary>
        /// 选项在线票数计数
        /// </summary>
        public int? Online_Count { get; set; }

        /// <summary>
        /// 选项离线票数计数
        /// </summary>
        public int? Offline_Count { get; set; }

        /// <summary>
        /// 选项查看次数计数
        /// </summary>
        public int? View_Count { get; set; }

        //LazyLoad
        /// <summary>
        /// 选项相关问题
        /// </summary>
        public virtual VT_Questions Question { get; set; }

        /// <summary>
        /// 选项相关图片
        /// </summary>
        public virtual VT_ItemImage ItemImage { get; set; }

        /// <summary>
        /// 选中的项目
        /// </summary>
        public virtual VT_Projects Project { get; set; }
    }

    public class VT_ItemImage
    {
        public VT_ItemImage()
        {
             
        }
        [Key]
        /// <summary>
        /// PK Guid
        /// </summary>
        public string Item_ID { get; set; }

        /// <summary>
        /// 选项图片
        /// </summary>
        public byte[] Item_Image { get; set; }
    }
}
